import request from '@/utils/request'

// 用户点击购买会员，生成一条“未支付”的订单
export const createVipOrder = (vipTypeId) => request.post(`/user/vip/purchase?vipTypeId=${vipTypeId}`)

// 查询所有可用的会员类型，供用户购买时参考。
export const getVipTypes = () => request.get('/user/vip/types')

// 查看已购买的所有VIP会员信息
export const getVipInfo = () => request.get('/user/vip/info')

// 查询会员订单历史
export const getVipOrders = () => request.get('/user/vip/orders')

// 支付会员订单
export const payByBalance = (vipOrderId, payPwd, payMethod) => request.post(`/user/vip/pay?vipOrderId=${vipOrderId}&payPwd=${payPwd}&payMethod=${payMethod}`)

// 用户续费VIP会员
export const renew = (vipTypeId, payPwd, payMethod) => request.post(`/user/vip/renew?vipTypeId=${vipTypeId}&payPwd=${payPwd}&payMethod=${payMethod}`)
